package com.haorui.lygyd.config;

import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

/**
 * @author 陈刚
 * @version 1.0
 * @project ZNSM
 * @package com.haorui.main.config
 * @createDate 2017-08-09 17:01
 * @modfiyDate
 * @function
 */
//@Configuration
//@EnableSwagger2
public class Swagger2Config {
//    @Bean
    public Docket createRestApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.haorui"))
                .paths(PathSelectors.any())
                .build();
    }

    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("中农商盟API接口")
                .description("查看API接口")
                .termsOfServiceUrl("http://127.0.0.1:8080/")
                .contact("陈刚")
                .version("1.0")
                .build();
    }

}
